<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

  <style>
    body,html{
      width: 100%;
      height: 100%;
      margin:0;
      padding:0;
      overflow: hidden;
    }
    canvas{
      background-color: transparent;
      margin:auto;
    }
  </style>
  <script src="jsmpeg.min.js"></script>
  <script src="ajax.js"></script>
  <script src="socket.io.js"></script>
  <script src="websocket.js"></script>
</head>
<body>
<canvas id="video-canvas" style="width: 100%;height:100%"></canvas>
<script>
  console.log("视频浏览器地址为："+window.location.href)
  let host = window.location.host
  host = 'amkj.cqemme.com:8443'
  const canvas = document.getElementById('video-canvas')
  ajax({
    url: `https://${host}/api/v1/rtsp/createFfmpeg`, // 请求地址
    type: 'GET', // 请求方式
    dataType: 'json', // 返回值类型的设定
    data: { id: 1 }, // 请求参数
    async: true, // 是否异步
    success: function(response, xml) {
      const res = JSON.parse(response)
      setTimeout(() => {
        const url = `wss://${host}/` + res.data
        const player1 = new JSMpeg.Player(url, { canvas: canvas, disableWebAssembly: false, audio: false })
      }, 50)
    },
    fail: function(status) {
      console.log('状态码为' + status) // 此处为执行成功后的代码
    }
  })
</script>
</body>


</html>
